-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create furness_balancing.R #36
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks @mem48 and quick work 👍 I will take a look and either push tweaks directly to this branch or put in a PR to your PR for anything I want your feedback on. As per my comment on the examples, I think users need a more tangible example based on a minimal real (or at least realistic) example dataset.
#' @return A vector of rounded numeric | ||
#' @export | ||
#' @example | ||
#' mat = matrix(rep(1, 6), nrow = 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see an example in the package's style. Clearly works but I think we should have an example that uses real example data. Could example datasets in this package work, or do we need to create more packaged data, e.g. starting with NTEM? Having done some reading it seems to me that Furness balancing is more about updating SIM estimates over time, which would be v. handy and links nicely with the spanishoddata package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know about over time, all of these functions are for filling in matrices where you know row/column totals but not internal values. So classic example is knowing the number of pupils at schools and the number of children in each LSOA, but you don't have OD data. You can prime the matrix with values from a distance decay curve and then run the furness balance and you should get a reasonable OD matrix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't the function assume OD data in matrix form, with rows representing origins and columns representing destinations?
Fine if so, although will not work on large sparse OD datasets, e.g. all schools to all LSOAs which would be 10 * 30 = 300,000,000 cells.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes all these functions are matrix based
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, need to chat this over. Next time both in office could be good.
New functions for Furness balancing matrixes
Note that all of these functions find "a" solution, but not always "the" solution. Sometimes no valid solution exists.